<template>
  <div class="logisticsDetails">
    <div class="topBox">
      <div class="company">
        <p class="font28">物流公司：</p>
        <p class="font26">{{logisticsList.expressProvider}}</p>
      </div>
      <div class="company">
        <p class="font28">物流单号：</p>
        <p class="font26">{{logisticsList.expressNumber}}</p>
        <button class="tag-read" :data-clipboard-text="logisticsList.expressNumber" @click="copy" 
        style="color: #1DB807;border: 1px solid #1DB807;border-radius: 4px;margin-left: 10px;background-color:#fff;cursor: pointer;">
        复制</button>
      </div>
    </div>
    <div class="hei28"></div>
    <div class="logisticsInfo">
        <div class="title">物流详情</div>
        <ul>
            <li :class="{topStep:i==0}" v-for="(v,i) in logisticsList.expressPathInfo" :key='i'>
              <div class="leftStep">
                <div class="bigCircle">
                  <div class="smallCircle"></div>
                </div>
                <div class="bigLine"></div>
              </div>
              <div class="rightStep">
                <p class="color666 mb9">{{v.logisticsInfo}}</p>
                <p class="color888 font14 mb9">{{v.timestamp}}</p>
              </div>
            </li>
          </ul>
    </div>
  </div>
</template>

<script>
import Clipboard from "clipboard"; //实现复制
import url from "../../axios/apiUrl";
import { getRequest } from "../../api/indexGet";
export default {
  data() {
    return {
      routerID: 0,
      logisticsList: [] //物流信息
    };
  },
  created() {
    getRequest(url.birdLogistics + "/"+this.$route.query.id).then(res => {
      if (res.data.code == "000000") {
        this.logisticsList = res.data.content.expressInfo;
      }
    });
  },
  methods: {
    // 点击复制事件
    copy() {
      var clipboard = new Clipboard(".tag-read");
      clipboard.on("success", e => {
        this.$toast("复制成功");
        // 释放内存
        clipboard.destroy();
      });
      clipboard.on("error", e => {
        // 不支持复制
        this.$toast("该浏览器不支持自动复制");
        // 释放内存
        clipboard.destroy();
      });
    }
  }
};
</script>

<style lang="less" scoped>
.logisticsDetails {
  .topBox {
    min-height: 128px;
    padding-top: 32px;
    .company {
      display: flex;
      margin: 0 0 32px 32px;
      align-items: center;
      .font28 {
        font-size: 28px;
        color: #333;
        font-weight: bold;
      }
      .font26 {
        font-size: 26px;
        color: #333;
        font-weight: 500;
      }
    }
  }
  .hei28 {
    height: 28px;
    background-color: #f1f2f6;
  }
  .logisticsInfo {
    padding: 0 32px;
    .title {
      height: 80px;
      color: #222;
      font-size: 28px;
      font-weight: bold;
      line-height: 80px;
      border-bottom: 1px solid #efefef;
      margin-bottom: 50px;
    }
    ul {
      margin-bottom: 50px;
      li {
        display: flex;
        margin-top: 2px;
        .leftStep {
          .bigCircle {
            width: 28px;
            height: 28px;
            background: #cccccc;
            border-radius: 50%;
          }
          .bigLine {
            width: 2px;
            height: 90px;
            background: #cccccc;
            margin: 2px 0 0 12px;
          }
        }
        .rightStep {
          margin-left: 10px;
          .color666 {
            color: #666;
            font-size: 26px;
            font-weight: 500;
            line-height: 32px;
          }
          .color888 {
            color: #888;
            font-size: 24px;
          }
          .mb9 {
            margin-bottom: 9px;
          }
        }
      }
      .topStep {
        .leftStep {
          .bigCircle {
            position: relative;
            background: #9ad991;
            .smallCircle {
              width: 16px;
              height: 16px;
              background: #3dbb2b;
              border-radius: 50%;
              position: absolute;
              margin: 5px auto;
              top: 0;
              bottom: 0;
              left: 0;
              right: 0;
            }
          }
          .bigLine {
            background: #3dbb2b;
          }
        }
        .rightStep {
          .color666 {
            color: #3dbb2b;
          }
          .color888 {
            color: #3dbb2b;
          }
        }
      }
    }
  }
}
</style>